from Base.Base import Base

from selenium.webdriver.common.by import By

import os

#定义页面对象类
class Page(Base):
    #图书搜索
    book = (By.ID, "searchQuery")
    #搜索功能
    sousuo = (By.ID, 'searchButton')

    #断言
    yuqi = (By.XPATH, '/html/body/div/div[2]/div[2]/p')

    # #悬停
    # xuant=(By.ID,'returnButton')
    #上传
    shangchuan=(By.ID,'uploadFile')


    def books(self):
        #获取UR地址
        self.open_url("file:///C:/Users/luojiale/Desktop/book.html" )
        #输入框
        self.send_keys(self.book, '三国演义')
        #点击搜索按钮
        self.click(self.sousuo)
        # #悬停
        # self.ActionChains(self.xuant)
        #上传
        self.send_keys(self.shangchuan,r'C:\Users\luojiale\Pictures\Screenshots\屏幕截图 2025-07-18 113158.png')

        #返回断言
        return self.open_text(self.yuqi)




